package com.cn.design.state;

/**
 * @author: zhangyiting
 * @description:
 * @createDate: Created in 2022/7/5 23:15
 * @version: 1.0
 */
public class EveningState extends State {
    @Override
    public void writeProgram(Work w) {
        if (w.getFinish())
        {
            w.setState(new RestState());
            w.writeProgram();
        } else{
            if (w.getHour() < 21)
            {
                System.err.println("当前时间:加班哦，疲累"+w.getHour()+"点");
            } else
            {
                w.setState(new SleepingState());
                w.writeProgram();
            }

        }
    }
}

